package cn.webdai.listener;

import cn.webdai.pojo.User;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 戴金华
 * @date 2019-12-05 9:43
 */
public class UserListener extends AnalysisEventListener<User> {

    private List<User> users = new ArrayList<>();

    public List<User> getUsers() {
        return users;
    }

    public void setUsers(List<User> users) {
        this.users = users;
    }

    @Override
    public void invoke(User user, AnalysisContext analysisContext) {
        users.add(user);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
        System.out.println(users);
    }
}
